package pro.cherish.knowledgeumldesignpattern.designPattern.com.cherish.prototype;

import java.util.Date;

//原型模式深复制
public class Client2 {
    public static void main(String [] args) throws CloneNotSupportedException {
        Date date=new Date(12312321331L);
        Sheep doli = new Sheep("多利", date);
        Sheep clone = (Sheep) doli.clone();   //实现深复制，cloned对象birthday是一个独立内存对象
        System.out.println(doli);
        date.setYear(2018);
        System.out.println(doli);
        System.out.println(clone);
    }

}
